<?php
include 'lib/PHPCaptcha.php';
$show_result = false;
if(isset($_POST['captcha_code'])){
    if(PHPCaptcha::validate($_POST['captcha_code'])){
        $pass = true;
    } else {
        $pass = false;
    }
    $show_result = true;
}
?>
<html>
<body>
<form method="post" action="">
<table>
<tr>
    <td><input type="text" name="captcha_code" /></td>
    <td><img src="img_captcha.php" /></td>
    <td><input type="submit" /></td>
</tr>
<?php if($show_result){ ?>
<tr>
    <td colspan="3"><?php if($pass) echo 'Right!'; else echo 'Wrong!';?></td>
</tr>
<?php } ?>
</table>
</form>
</body>
</html>

